package com.ctshk.common.sms.constant;

/**
 * <p>
 *  短信错误码
 * </p>
 *
 * @author 李新科
 * @date 2021/6/5 13:10
 */
public enum SmsCode {
    OK("OK","OK"),
    SMS_SIGNATURE_SCENE_ILLEGAL("isv.SMS_SIGNATURE_SCENE_ILLEGAL","短信所使用签名场景非法"),
    EXTEND_CODE_ERROR("isv.EXTEND_CODE_ERROR","扩展码使用错误，相同的扩展码不可用于多个签名"),
    DOMESTIC_NUMBER_NOT_SUPPORTED("isv.DOMESTIC_NUMBER_NOT_SUPPORTED","国际/港澳台消息模板不支持发送境内号码"),
    DENY_IP_RANGE("isv.DENY_IP_RANGE","源IP地址所在的地区被禁用"),
    DAY_LIMIT_CONTROL("isv.DAY_LIMIT_CONTROL","触发日发送限额"),
    SMS_CONTENT_ILLEGAL("isv.SMS_CONTENT_ILLEGAL","短信内容包含禁止发送内容"),
    SMS_SIGN_ILLEGAL("isv.SMS_SIGN_ILLEGAL","签名禁止使用"),
    RAM_PERMISSION_DENY("isp.RAM_PERMISSION_DENY","RAM权限DENY"),
    OUT_OF_SERVICE("isv.OUT_OF_SERVICE","业务停机"),
    PRODUCT_UN_SUBSCRIPT("isv.PRODUCT_UN_SUBSCRIPT","未开通云通信产品的阿里云客户"),
    PRODUCT_UNSUBSCRIBE("isv.PRODUCT_UNSUBSCRIBE","产品未开通"),
    ACCOUNT_NOT_EXISTS("isv.ACCOUNT_NOT_EXISTS","账户不存在"),
    ACCOUNT_ABNORMAL("isv.ACCOUNT_ABNORMAL","账户异常"),
    SMS_TEMPLATE_ILLEGAL("isv.SMS_TEMPLATE_ILLEGAL","短信模版不合法"),
    SMS_SIGNATURE_ILLEGAL("isv.SMS_SIGNATURE_ILLEGAL","短信签名不合法"),
    INVALID_PARAMETERS("isv.INVALID_PARAMETERS","参数异常"),
    SYSTEM_ERROR("isp.SYSTEM_ERROR","系统错误"),
    MOBILE_NUMBER_ILLEGAL("isv.MOBILE_NUMBER_ILLEGAL","非法手机号"),
    MOBILE_COUNT_OVER_LIMIT("isv.MOBILE_COUNT_OVER_LIMIT","手机号码数量超过限制"),
    TEMPLATE_MISSING_PARAMETERS("isv.TEMPLATE_MISSING_PARAMETERS","模版缺少变量"),
    BUSINESS_LIMIT_CONTROL("isv.BUSINESS_LIMIT_CONTROL","业务限流"),
    INVALID_JSON_PARAM("isv.INVALID_JSON_PARAM","JSON参数不合法，只接受字符串值"),
    BLACK_KEY_CONTROL_LIMIT("isv.BLACK_KEY_CONTROL_LIMIT","黑名单管控"),

    PARAM_LENGTH_LIMIT("isv.PARAM_LENGTH_LIMIT","参数超出长度限制"),
    PARAM_NOT_SUPPORT_URL("isv.PARAM_NOT_SUPPORT_URL","不支持URL"),
    AMOUNT_NOT_ENOUGH("isv.EXTEND_CODE_ERROR","账户余额不足"),
    TEMPLATE_PARAMS_ILLEGAL("isv.TEMPLATE_PARAMS_ILLEGAL","模版变量里包含非法关键字"),
    SignatureDoesNotMatch("SignatureDoesNotMatch","签名（Signature）加密错误"),
    INVALIDTIMESTAMP_EXPIRED("InvalidTimeStamp.Expired","时间戳错误"),
    SIGNATURE_NONCEUSED("SignatureNonceUsed","唯一随机数重复"),
    INVALID_VERSION("InvalidVersion","版本号（Version）错误"),
    INVALIDACTION_NOTFOUND("InvalidAction.NotFound","参数Action中指定的接口名错误"),
    SIGN_COUNT_OVER_LIMIT("isv.SIGN_COUNT_OVER_LIMIT","一个自然日中申请签名数量超过限制。"),
    TEMPLATE_COUNT_OVER_LIMIT("isv.TEMPLATE_COUNT_OVER_LIMIT","一个自然日中申请模板数量超过限制"),
    SIGN_NAME_ILLEGAL("isv.SIGN_NAME_ILLEGAL","签名名称不符合规范"),
    SIGN_FILE_LIMIT("isv.SIGN_FILE_LIMIT","签名认证材料附件大小超过限制"),
    SIGN_OVER_LIMIT("isv.SIGN_OVER_LIMIT","签名字符数量超过限制"),
    TEMPLATE_OVER_LIMIT("isv.TEMPLATE_OVER_LIMIT","模板字符数量超过限制"),
    SIGNATURE_BLACKLIST("SIGNATURE_BLACKLIST","签名黑名单"),
    SHORTURL_OVER_LIMIT("isv.SHORTURL_OVER_LIMIT","一天创建短链数量超过限制"),
    NO_AVAILABLE_SHORT_URL("isp.NO_AVAILABLE_SHORT_URL","无有效短链"),
    SHORTURL_NAME_ILLEGAL("isv.SHORTURL_NAME_ILLEGAL","短链名称非法"),
    SOURCEURL_OVER_LIMIT("isv.SOURCEURL_OVER_LIMIT","原始链接字符数量超过限制"),
    SHORTURL_TIME_ILLEGAL("isv.SHORTURL_TIME_ILLEGAL","短链有效期期限超过限制"),
    PHONENUMBERS_OVER_LIMIT("isv.PHONENUMBERS_OVER_LIMIT","上传手机号个数超过上"),
    SHORTURL_STILL_AVAILABLE("isv.SHORTURL_STILL_AVAILABLE","原始链接生成的短链仍在有效期内"),
    SHORTURL_NOT_FOUND("isv.SHORTURL_NOT_FOUND","没有可删除的短链"),
    ERROR_SIGN_NOT_MODIFY("isv.ERROR_SIGN_NOT_MODIFY","签名不支持修改"),
    ;


    SmsCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private String code;
    private String msg;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static String getMsgByCode(String code) {
        for (SmsCode value : SmsCode.values()) {
            if(value.getCode().equals(code)) {
                return value.getMsg();
            }
        }

        return SYSTEM_ERROR.getMsg();
    }

}
